home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / sb.xml < prev    next >
Text File  |  2002-08-30  |  6KB  |  159 lines

  1. <search function="sb">
  2.   <name>Switchboard</name>
  3.   <description>
  4.     Look up people and businesses by name or telephone number or browse all businesses in a given category. The location can be just a state or the city and state separated by a comma.<br/>
  5.     <div class="helpboxDescLabels">Usage:</div>
  6.     <table class="helpboxDescTable">
  7.       <tr><td>Person/Business</td><td> - </td><td>sb <<i>name</i>> [(<<i>location</i>>)] {/person | /business | /category}</td></tr>
  8.       <tr><td>Telephone</td><td> - </td><td>sb <<i>number</i>> {/person | /business}</td></tr>
  9.     </table>
  10.     <div class="helpboxDescLabels">Switches:</div>
  11.     <table class="helpboxDescTable">
  12.       <tr><td>/person</td><td> - </td><td>Search for a person at the given location.</td></tr>
  13.       <tr><td>/business</td><td> - </td><td>Search for a business at the given location.</td></tr>
  14.       <tr><td>/category</td><td> - </td><td>Searches for all businesses of the given category at the given location.</td></tr>
  15.     </table>
  16.     <div class="helpboxDescLabels">Examples:</div>
  17.     <table class="helpboxDescTable">
  18.  
  19.       <tr><td>sb barbers (Pittsford, NY) /business</td></tr>
  20.       <tr><td>sb John Doe (IL) /person</td></tr>
  21.       <tr><td>sb Barbers (Los Angelas, CA) /category</td></tr>
  22.       <tr><td>sb 214-555-9090</td></tr>
  23.       <tr><td>sb 214.555.9090 /person</td></tr>
  24.       <tr><td>sb 2145559090 /business</td></tr>
  25.     </table>
  26.   </description>
  27.   <category>People and Places</category>
  28.   <link>http://www.switchboard.com/</link>
  29.   <contributor>Ryan Edwards</contributor>
  30.   
  31.   <form name="sbf_indv"
  32.         action="http://www.switchboard.com/bin/cgiqa.dll"
  33.         method="get">
  34.     <input type="hidden" name="SR" value=""/>
  35.     <input type="hidden" name="MEM" value="1"/>
  36.     <input type="hidden" name="F" value=""/>
  37.     <input type="hidden" name="L" value=""/>
  38.     <input type="hidden" name="T" value=""/>
  39.     <input type="hidden" name="s" value=""/>
  40.   </form>
  41.   
  42.   <form name="sbf_phone"
  43.         action="http://www.switchboard.com/bin/cgirlookup.dll"
  44.         method="get">
  45.     <input type="hidden" name="at" value=""/>
  46.     <input type="hidden" name="e" value=""/>
  47.     <input type="hidden" name="n" value=""/>
  48.     <input type="hidden" name="type" value=""/>
  49.     <input type="hidden" name="SR" value=""/>
  50.     <input type="hidden" name="MEM" value=""/>
  51.     <input type="hidden" name="LNK" value=""/>
  52.   </form>
  53.   
  54.   <form name="sbf_bus"
  55.         action="http://www.switchboard.com/bin/cgidir.dll"
  56.         method="get">
  57.     <input type="hidden" name="FUNC" value="FORMATSEARCH"/>
  58.     <input type="hidden" name="MEM" value="1"/>
  59.     <input type="hidden" name="TYPE" value=""/>
  60.     <input type="hidden" name="C" value=""/>
  61.     <input type="hidden" name="L" value=""/>
  62.     <input type="hidden" name="T" value=""/>
  63.     <input type="hidden" name="s" value=""/>
  64.   </form>
  65.   
  66.   <script><![CDATA[
  67.     function sb(q)
  68.     {
  69.       var searchGroup = 0;
  70.       var args = parseArgs(q, "person, business, category");
  71.       if( nullArgs("sb",args.q) )
  72.       {
  73.         return false;
  74.       }
  75.       else
  76.       {
  77.         if( args.switches.length == 1 )
  78.         {
  79.           for( var j=0; j<args.switches.length; j++ )
  80.             switch( args.switches[j].name )
  81.             {
  82.               case "person": searchGroup = 0; break;
  83.               case "business": searchGroup = 1; break;
  84.               case "category": searchGroup = 2; break;
  85.             }
  86.         }
  87.         // else ... default to person search
  88.         
  89.         // The search was for a phone number, so do a reverse lookup.
  90.         var parsed = args.q.match( /(\d{3})-*\.*(\d{3})-*\.*(\d{4})/ );
  91.         if( parsed )
  92.         {
  93.           switch( searchGroup )
  94.           {
  95.             case 0: document.sbf_phone.type.value = "RES"; break;
  96.             case 1: document.sbf_phone.type.value = "BUS"; break;
  97.             case 2: nullArgs("sb","?"); return false;
  98.             default: document.sbf_phone.type.value = "BOTH"; break;
  99.           } 
  100.           
  101.           document.sbf_phone.at.value = parsed[1];
  102.           document.sbf_phone.e.value = parsed[2];
  103.           document.sbf_phone.n.value = parsed[3];
  104.           submitForm(sbf_phone);
  105.         }
  106.         
  107.         // Individual person search.
  108.         else if( searchGroup == 0 )
  109.         {
  110.           parsed = args.q.match( /(((\w+\s+)?\w+)\s+)?(\w+)(\s*\((([^,]+),?\s*)?(\w\w)\))?/ );
  111.           
  112.           document.sbf_indv.F.value=(parsed[2] ? parsed[2] : "");
  113.           document.sbf_indv.L.value=(parsed[4] ? parsed[4] : "");
  114.           document.sbf_indv.T.value=(parsed[7] ? parsed[7] : "");
  115.           document.sbf_indv.s.value=(parsed[8] ? parsed[8].toUpperCase() : "");
  116.           submitForm(sbf_indv);
  117.         }
  118.         
  119.         else if( searchGroup > 0 )
  120.         {
  121.           parsed = args.q.match( /(\w[^\(]*\w)(\s*\((([^,]+),?\s*)?(\w\w)\))?/ );
  122.           
  123.           document.sbf_bus.T.value=(parsed[4] ? parsed[4] : "");
  124.           document.sbf_bus.s.value=(parsed[5] ? parsed[5].toUpperCase() : "");
  125.           
  126.           switch( searchGroup )
  127.           {
  128.             // Business search.
  129.             case 1:
  130.               document.sbf_bus.L.value=(parsed[1] ? parsed[1] : "");
  131.               document.sbf_bus.C.value="";
  132.               break;
  133.             
  134.             // Business category search.
  135.             case 2:
  136.               document.sbf_bus.C.value=(parsed[1] ? parsed[1] : "");
  137.               document.sbf_bus.L.value="";
  138.               break;
  139.           }
  140.           
  141.           submitForm(sbf_bus);
  142.         }
  143.         
  144.         else
  145.         {
  146.           nullArgs( "sb", "?" );
  147.           return false;
  148.         }   
  149.       } 
  150.     }
  151.   ]]></script>
  152.  
  153.   <copyright>
  154.     Copyright (c) 2002 David Bau
  155.     Distributed under the terms of the
  156.     GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  157.   </copyright>
  158. </search>
  159.